#include <iostream>
#include <unistd.h>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        cout<<"pid: "<<getpid()<<" execl before"<<endl;
        //execl("/usr/bin/ls", "ls", "-l", "-a",NULL);
        //execl("/usr/bin/pwd", "pwd",NULL);
        execl("/usr/bin/bash", "bash","test.sh",NULL);
        //execl("./mytest", "mytest",NULL);
        cout<<"pid: "<<getpid()<<" execl after"<<endl;
    }
    else{
       pid_t rid =  wait(NULL);
       if(rid > 0)
       {
           cout<<"wait success, rid:"<<rid<<endl;
       }
        
    }

    return 0;
}
